import request from '@/utils/request'

const prePath = '/base'

//获取所有菜单
export function getAllMenu(params) {
  return request({
    url: prePath + '/menus/all',
    method: 'get',
    params,
  })
}

//创建菜单
export function createMenu(data) {
  return request({
    url: prePath + '/menus',
    method: 'post',
    data,
  })
}

//更新菜单
export function updateMenu(data) {
  return request({
    url: prePath + '/menus',
    method: 'put',
    data,
  })
}

//获取菜单详情
export function getMenuDetail(id) {
  return request({
    url: prePath + '/menus/' + id,
    method: 'get',
  })
}

//获取菜单树
export function getMenusTree(params) {
  return request({
    url: prePath + '/menus/trees',
    method: 'get',
    params,
  })
}

//获取菜单
export function getMenusPcList() {
  return request({
    url: prePath + '/menus/pcList',
    method: 'get',
  })
}

//获取带资源的菜单树
export function getMenusTreeWithResources(params) {
  return request({
    url: prePath + '/menus/trees/resources',
    method: 'get',
    params,
  })
}

//系统权限模板获取带资源的菜单树
export function sysPermissionMenusTreeWithResources(params) {
  return request({
    url: prePath + '/menus/trees/sysPermissionResources',
    method: 'get',
    params,
  })
}

//机构权限模板
export function orgAuthGetMenusTreeWithResources(params) {
  return request({
    url: prePath + '/menus/trees/orgAuthResources',
    method: 'get',
    params,
  })
}

//系统权限模板获取带资源的菜单树
export function roleOrUserGetMenusTreeWithResources(params) {
  return request({
    url: prePath + '/menus/trees/roleOrUserResources',
    method: 'get',
    params,
  })
}

//获取菜单树需勾选的节点code
export function getMenusDefaultChecked(params) {
  return request({
    url: prePath + '/menus/trees/checked',
    method: 'get',
    params,
  })
}

//删除菜单,物理删除
export function deleteMenus(data) {
  return request({
    url: prePath + '/menus',
    method: 'delete',
    data,
  })
}

//获取机构分页
export function getOrgPages(params) {
  return request({
    url: prePath + '/orgs/page',
    method: 'get',
    params,
  })
}
//获取机构分页-自定义
export function getOrgcustomizeListPages(data) {
  return request({
    url: prePath + '/orgs/customizeList/page',
    method: 'post',
    data,
  })
}

//获取机构分页-不排除当前登陆人机构
export function getOrgPagesAll(params) {
  return request({
    url: prePath + '/orgs/pageAll',
    method: 'get',
    params,
  })
}
//获取机构
export function getOrgById(id) {
  return request({
    url: prePath + '/orgs/' + id,
    method: 'get',
  })
}

//获取机构所有
export function getOrgAll(params) {
  return request({
    url: prePath + '/orgs/all',
    method: 'get',
    params,
  })
}

//获取所有字典
export function getDictAll(params) {
  return request({
    url: prePath + '/dicts/all',
    method: 'get',
    params,
  })
}

//获取所有字典map
export function getDictMap(params) {
  return request({
    url: prePath + '/dicts/map',
    method: 'get',
    params,
  })
}

//新增字典
export function createDict(data) {
  return request({
    url: prePath + '/dicts',
    method: 'post',
    data,
  })
}

//更新字典
export function updateDict(data) {
  return request({
    url: prePath + '/dicts',
    method: 'put',
    data,
  })
}

//根据字典code查询字典项
export function getDictItemByDictCode(params) {
  return request({
    url: prePath + '/dicts/items/dictCode/' + params,
    method: 'get',
  })
}

//查询字典分页
export function getDictItemAll(params) {
  return request({
    url: prePath + '/dicts/items/all',
    method: 'get',
    params,
  })
}

//删除字典，物理删除
export function delDict(data) {
  return request({
    url: prePath + '/dicts',
    method: 'delete',
    data,
  })
}

//新增字典项
export function createDictItem(data) {
  return request({
    url: prePath + '/dicts/items',
    method: 'post',
    data,
  })
}

//修改字典项
export function updateDictItem(data) {
  return request({
    url: prePath + '/dicts/items',
    method: 'put',
    data,
  })
}

//字典项设置默认
export function setDefaultDictItem(data) {
  return request({
    url: prePath + '/dicts/items/setDefault',
    method: 'post',
    data,
  })
}

//删除字典项，物理删除
export function delDictItem(data) {
  return request({
    url: prePath + '/dicts/items',
    method: 'delete',
    data,
  })
}

//新增机构
export function createOrg(data) {
  return request({
    url: prePath + '/orgs',
    method: 'post',
    data,
  })
}

//修改机构
export function updateOrg(data) {
  return request({
    url: prePath + '/orgs',
    method: 'put',
    data,
  })
}
export function updatePlatformApplicationInfo(data) {
  return request({
    url: prePath + '/platformApplicationInfo',
    method: 'put',
    data,
  })
}
export function auditPlatformApplicationInfo(data) {
  return request({
    url: prePath + '/platformApplicationInfo/audit',
    method: 'put',
    data,
  })
}

//自动生成供应商
export function autoInsertSupplier(data) {
  return request({
    url: prePath + '/orgs/autoAdd',
    method: 'post',
    data,
  })
}

//启用机构
export function enableOrg(data) {
  return request({
    url: prePath + '/orgs/enabled',
    method: 'post',
    data,
  })
}

//停用机构
export function disableOrg(data) {
  return request({
    url: prePath + '/orgs/disabled',
    method: 'post',
    data,
  })
}

//获取用户按钮权限集合
export function getPermissionCodes(params) {
  return request({
    url: prePath + '/permissions/codes',
    method: 'get',
    params,
  })
}

//批量更新系统权限模板权限
export function batchUpdateSysPermissions(data) {
  return request({
    url: prePath + '/sysPermissionTemplate/batchUpdateBasePermission',
    method: 'put',
    data,
  })
}

//批量更新权限
export function batchUpdatePermissions(data) {
  return request({
    url: prePath + '/permissions/batchUpdate',
    method: 'put',
    data,
  })
}

//根据实体删除数据
export function deletePermissionsByEntity(data) {
  return request({
    url: prePath + '/permissions/delete',
    method: 'delete',
    data,
  })
}

//获取资源列表
export function getResourcesAll(params) {
  return request({
    url: prePath + '/resources/all',
    method: 'get',
    params,
  })
}

//创建资源
export function createResources(data) {
  return request({
    url: prePath + '/resources',
    method: 'post',
    data,
  })
}

//修改资源
export function updateResources(data) {
  return request({
    url: prePath + '/resources',
    method: 'put',
    data,
  })
}

//删除资源，物理删除
export function deleteResources(data) {
  return request({
    url: prePath + '/resources',
    method: 'delete',
    data,
  })
}
//获取分页角色列表
export function getRolePage(params) {
  return request({
    url: prePath + '/roles/page',
    method: 'get',
    params,
  })
}
//获取分页角色列表
export function getRoleAll(params) {
  return request({
    url: prePath + '/roles/all',
    method: 'get',
    params,
  })
}
export function createRole(data) {
  return request({
    url: prePath + '/roles',
    method: 'post',
    data,
  })
}
export function updateRole(data) {
  return request({
    url: prePath + '/roles',
    method: 'put',
    data,
  })
}
export function deleteRole(data) {
  return request({
    url: prePath + '/roles',
    method: 'delete',
    data,
  })
}

export function deleteUser(data) {
  return request({
    url: prePath + '/users',
    method: 'delete',
    data,
  })
}

//获取单据序列分页
export function getOrderSequencePage(params) {
  return request({
    url: prePath + '/orders/sequence/page',
    method: 'get',
    params,
  })
}

//新增单据序列
export function createOrderSequencePage(data) {
  return request({
    url: prePath + '/orders/sequence',
    method: 'post',
    data,
  })
}

//更新单据序列
export function updateOrderSequencePage(data) {
  return request({
    url: prePath + '/orders/sequence',
    method: 'put',
    data,
  })
}
//获取单据序列详情
export function getOrderSequenceDetail(id) {
  return request({
    url: prePath + '/orders/sequence/detail/' + id,
    method: 'get',
  })
}

//获取用户列表分页
export function getUserPage(params) {
  return request({
    url: prePath + '/users/page',
    method: 'get',
    params,
  })
}
export function getOrganizationUserPage(params) {
  return request({
    url: prePath + '/users/organizationPage',
    method: 'get',
    params,
  })
}

//创建用户
export function createUser(data) {
  return request({
    url: prePath + '/users',
    method: 'post',
    data,
  })
}

//更新用户
export function updateUser(data) {
  return request({
    url: prePath + '/users/update',
    method: 'put',
    data,
  })
}

//机构锁定/解锁关联的用户
export function updateLockedByOrg(data) {
  return request({
    url: prePath + '/users/updateLockedByOrg',
    method: 'put',
    data,
  })
}

//系统配置分页查询
export function getBaseSystemConfigPage(params) {
  return request({
    url: prePath + '/systemConfig/page',
    method: 'get',
    params,
  })
}

//系统配置分页查询
export function getBaseSystemConfigAll(params) {
  return request({
    url: prePath + '/systemConfig/all',
    method: 'get',
    params,
  })
}

//创建系统配置
export function createBaseSystemConfig(data) {
  return request({
    url: prePath + '/systemConfig',
    method: 'post',
    data,
  })
}

//更新系统配置
export function updateBaseSystemConfig(data) {
  return request({
    url: prePath + '/systemConfig',
    method: 'put',
    data,
  })
}

//获取二维码规则分页
export function getQrCodeRule(params) {
  return request({
    url: prePath + '/qrCode/find',
    method: 'get',
    params,
  })
}
export function setDefault(params) {
  return request({
    url: prePath + '/qrCode/updateDefault',
    method: 'put',
    params,
  })
}

export function deleteQrCodeRuleBatch(data) {
  return request({
    url: prePath + '/qrCode/deleteBatch',
    method: 'delete',
    data,
  })
}

export function insertQrCodeRule(data) {
  return request({
    url: prePath + '/qrCode',
    method: 'post',
    data,
  })
}
export function findQrCodeRule(id) {
  return request({
    url: prePath + '/qrCode/findCodeDetail/' + id,
    method: 'get',
  })
}

export function findQrCodeRuleDetail(params) {
  return request({
    url: prePath + '/qrCodeRelation/findDetail',
    method: 'get',
    params,
  })
}

export function updateQrCodeRule(data) {
  return request({
    url: prePath + '/qrCode',
    method: 'put',
    data,
  })
}

export function getProductIdUseInQrCode(params) {
  return request({
    url: prePath + '/qrCodeRelation/getProductIdUseInQrCode',
    method: 'get',
    params,
  })
}

export function getDeviceIdUseInQrCode(params) {
  return request({
    url: prePath + '/qrCodeDetail/getDeviceIdUseInQrCode',
    method: 'get',
    params,
  })
}

//获取接口配置分页
export function getInterfaceConfigPage(params) {
  return request({
    url: prePath + '/interfaceConfigs/page',
    method: 'get',
    params,
  })
}

//新增接口配置
export function createInterfaceConfig(data) {
  return request({
    url: prePath + '/interfaceConfigs',
    method: 'post',
    data,
  })
}

//更新接口配置分页
export function updateInterfaceConfig(data) {
  return request({
    url: prePath + '/interfaceConfigs',
    method: 'put',
    data,
  })
}

// 获取所有地区

export function getRegion() {
  return request({
    url: prePath + '/baseRegion/all',
    method: 'get',
  })
}

//切换用户部门
export function adjustDept(data) {
  return request({
    url: prePath + '/users/adjustDept',
    method: 'post',
    data,
  })
}

//确认机构信息审核
export function orgInfoConfirm(data) {
  return request({
    url: prePath + '/orgInfoCheck/confirm',
    method: 'post',
    data,
  })
}
export function orgInfoApproved(data) {
  return request({
    url: prePath + '/orgInfoCheck/approved',
    method: 'post',
    data,
  })
}

//拒绝机构信息审核
export function orgInfoRefuse(data) {
  return request({
    url: prePath + '/orgInfoCheck/refuse',
    method: 'post',
    data,
  })
}
// 驳回
export function orgInfoReject(data) {
  return request({
    url: prePath + '/orgInfoCheck/reject',
    method: 'post',
    data,
  })
}
export function orgInfoRefuseWithReason(data) {
  return request({
    url: prePath + '/orgInfoCheck/refuseWithReason',
    method: 'post',
    data,
  })
}

//确认平台机构信息审核
export function platformInfoConfirm(data) {
  return request({
    url: prePath + '/platformApplicationInfo/confirm',
    method: 'put',
    data,
  })
}

//拒绝平台机构信息审核
export function platformInfoRefuse(data) {
  return request({
    url: prePath + '/platformApplicationInfo/refuse',
    method: 'put',
    data,
  })
}

export function getPlatformApplicationInfo(id) {
  return request({
    url: prePath + '/platformApplicationInfo/' + id,
    method: 'get',
  })
}

//获取审核机构信息明细
export function getOrgInfoCheck(id) {
  return request({
    url: prePath + `/orgInfoCheck/info/${id}`,
    method: 'get',
  })
}

// 获取机构信息审核分页
export function getOrgInfoCheckPage(params) {
  return request({
    url: prePath + '/orgInfoCheck/page',
    method: 'get',
    params,
  })
}

// 获取平台机构审核分页
export function getPlatformInfoCheckPage(params) {
  return request({
    url: prePath + '/platformApplicationInfo/page',
    method: 'get',
    params,
  })
}

/* 人员部门查询 */
export function getRrgUserList(params) {
  return request({
    url: prePath + '/users/orgUserList/page',
    method: 'get',
    params,
  })
}
export function getRrgUserAll(params) {
  return request({
    url: prePath + '/users/orgUserList/listAll',
    method: 'get',
    params,
  })
}
// 通过部门获取用户
export function getOrganizationAll(params) {
  return request({
    url: prePath + '/users/organizationAll',
    method: 'get',
    params,
  })
}
// 通过部门获取用户
export function getOrganizationPage(params) {
  return request({
    url: prePath + '/users/organizationPage',
    method: 'get',
    params,
  })
}
export function getRrgUserPage(params) {
  return request({
    url: prePath + '/users/orgUserList/page',
    method: 'get',
    params,
  })
}

export function getDeptUserAll(params) {
  return request({
    url: prePath + '/users/all',
    method: 'get',
    params,
  })
}
export function getDeptUserPage(params) {
  return request({
    url: prePath + '/users/page',
    method: 'get',
    params,
  })
}

/* 打印模板分页查询 */
export function fatchPrintTemplate(params) {
  return request({
    url: prePath + '/printTemplate/page',
    method: 'get',
    params,
  })
}

export function postPrintTemplate(data) {
  return request({
    url: prePath + '/printTemplate',
    method: 'post',
    data,
  })
}

export function putPrintTemplate(data) {
  return request({
    url: prePath + '/printTemplate',
    method: 'put',
    data,
  })
}
export function deletePrintTemplate(data) {
  return request({
    url: prePath + '/printTemplate',
    method: 'delete',
    data,
  })
}

// 根据资源code获取对应的默认模板
export function fatchPrintTemplateCode(data) {
  return request({
    url: prePath + '/printTemplate/getDefaultTemplate',
    method: 'post',
    data,
  })
}

// 根据资源code获取对应的默认模板
export function fatchTemplateByCode(data) {
  return request({
    url: prePath + '/printTemplate/getTemplate',
    method: 'post',
    data,
  })
}
// 根据资源code获取对应的默认模板
export function getInitPrintDetail(params) {
  return request({
    url: prePath + '/printTemplate/getInitPrintDetail',
    method: 'get',
    params,
  })
}

//获取字典树
export function getDictTree(params) {
  return request({
    url: prePath + '/dicts/tree',
    method: 'get',
    params,
  })
}

//获取系统权限模板
export function getSysPermissionTemplate(params) {
  return request({
    url: prePath + '/sysPermissionTemplate/page',
    method: 'get',
    params,
  })
}

//新增或修改系统权限模板
export function modifySysPermissionTemplate(data, method) {
  return request({
    url: prePath + '/sysPermissionTemplate',
    method,
    data,
  })
}

// ======== his ========
export function getHisHitDepot(params) {
  return request({
    url: prePath + '/hishitdepot/page',
    method: 'get',
    params,
  })
}
export function createHisHitDepot(data) {
  return request({
    url: prePath + '/hishitdepot',
    method: 'post',
    data,
  })
}

export function deleteHisHitDepot(data) {
  return request({
    url: prePath + '/hishitdepot',
    method: 'delete',
    data,
  })
}
export function createAnnexUpload(data) {
  return request({
    url: prePath + '/annexUpload',
    method: 'post',
    data,
  })
}
export function deleteAnnexUpload(id) {
  return request({
    url: prePath + '/annexUpload/' + id,
    method: 'delete',
  })
}

// 接口日志页
export function getLogInterface(params) {
  return request({
    url: prePath + '/logInterfaceInvoke/page',
    method: 'get',
    params,
  })
}

export function retryLogInterface(id) {
  return request({
    url: prePath + '/logInterfaceInvoke/retry/' + id,
    method: 'put',
  })
}

export function getLogInterfaceDetail(id) {
  return request({
    url: prePath + '/logInterfaceInvoke/' + id,
    method: 'get',
  })
}

// 对接系统页
export function getThirdSystem(params) {
  return request({
    url: prePath + '/thirdSystemLogin/page',
    method: 'get',
    params,
  })
}

export function getThirdSystemAll(params) {
  return request({
    url: prePath + '/thirdSystemLogin/all',
    method: 'get',
    params,
  })
}

export function getInterfaceTypePage(params) {
  return request({
    url: prePath + '/invokeSystemConfig/interfaceTypePage',
    method: 'get',
    params,
  })
}

export function createThirdSystem(data) {
  return request({
    url: prePath + '/thirdSystemLogin',
    method: 'post',
    data,
  })
}

export function putThirdSystem(data) {
  return request({
    url: prePath + '/thirdSystemLogin',
    method: 'put',
    data,
  })
}

export function deleteThirdSystem(id) {
  return request({
    url: prePath + '/thirdSystemLogin/' + id,
    method: 'delete',
  })
}

export function startThirdSystem(data) {
  return request({
    url: prePath + '/thirdSystemLogin/enable',
    method: 'put',
    data,
  })
}

export function stopThirdSystem(data) {
  return request({
    url: prePath + '/thirdSystemLogin/disable',
    method: 'put',
    data,
  })
}

// 接口设置页
export function getInvokeInterface(params) {
  return request({
    url: prePath + '/invokeInterface/page',
    method: 'get',
    params,
  })
}

export function getInvokeInterfaceAll(params) {
  return request({
    url: prePath + '/invokeInterface/all',
    method: 'get',
    params,
  })
}

export function createInvokeInterface(data) {
  return request({
    url: prePath + '/invokeInterface',
    method: 'post',
    data,
  })
}

export function putInvokeInterface(data) {
  return request({
    url: prePath + '/invokeInterface',
    method: 'put',
    data,
  })
}

export function deleteInvokeInterface(id) {
  return request({
    url: prePath + '/invokeInterface/' + id,
    method: 'delete',
  })
}

export function deleteInvokeInterfaceBatch(data) {
  return request({
    url: prePath + '/invokeInterface',
    method: 'delete',
    data,
  })
}

// 接口管理页
export function getInvokeSystemConfig(params) {
  return request({
    url: prePath + '/invokeSystemConfig/page',
    method: 'get',
    params,
  })
}

export function createInvokeSystemConfig(data) {
  return request({
    url: prePath + '/invokeSystemConfig',
    method: 'post',
    data,
  })
}

export function updateInvokeSystemConfig(data) {
  return request({
    url: prePath + '/invokeSystemConfig',
    method: 'put',
    data,
  })
}

export function startInvokeSystemConfig(data) {
  return request({
    url: prePath + '/invokeSystemConfig/enable',
    method: 'put',
    data,
  })
}

export function stopInvokeSystemConfig(data) {
  return request({
    url: prePath + '/invokeSystemConfig/disable',
    method: 'put',
    data,
  })
}

export function deleteInvokeSystemConfig(id) {
  return request({
    url: prePath + '/invokeSystemConfig/' + id,
    method: 'delete',
  })
}

//删除签名
export function updateElectronicSignaturePath(data) {
  return request({
    url: prePath + '/users/updateElectronicSignaturePath',
    method: 'put',
    data,
  })
}
//设置会计期间保存
export function creatBaseFiscalPeriod(data) {
  return request({
    url: prePath + '/baseFiscalPeriod/fiscalPeriodSetting',
    method: 'post',
    data,
  })
}
//获取会计区间列表
export function getBaseFiscalPeriodCustomizeListPage(data) {
  return request({
    url: prePath + '/baseFiscalPeriod/customizeList/page',
    method: 'post',
    data,
  })
}
//获取会计区间列表
export function getBaseFiscalPeriodPage(params) {
  return request({
    url: prePath + '/baseFiscalPeriod/page',
    method: 'get',
    params,
  })
}
//获取会计区间列表
export function getBaseFiscalPeriodEndDate(data) {
  return request({
    url: prePath + '/baseFiscalPeriod/getEndDate/' + data,
    method: 'get',
  })
}
export function getOrgInfoCheckDifference(data) {
  return request({
    url: prePath + '/orgInfoCheck/difference',
    method: 'post',
    data,
  })
}

//获取菜单详情
export function showSourceDetail(id) {
  return request({
    url: prePath + '/orders/sequence/queryPath/' + id,
    method: 'get',
  })
}
//对接系统连接测试
export function thirdSystemLoginTestConnection(data) {
  return request({
    url: prePath + '/thirdSystemLogin/testConnection',
    method: 'put',
    data,
  })
}

//获取单据序列
export function getSequence(params) {
  return request({
    url: prePath + '/orders/sequence/getStatus',
    method: 'get',
    params,
  })
}